
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import=" be.atc.antoine.beans.Calendrier" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="icon" type="image/png" href="/TFE_Gestidot/IMG/favicon.png">	
		
		<link rel="stylesheet" type="text/css" href= "/TFE_Gestidot/CSS/bootstrap.min.css" media="all" />
		<link rel="stylesheet" type="text/css" href= "/TFE_Gestidot/CSS/bootstrap-theme.min.css" media="all" />
		<!-- FIN Style bootstrap twitter -->
	
		<link rel="stylesheet" type="text/css" href="/TFE_Gestidot/CSS/jquery-ui-1.10.3.custom.min.css" media="all" />
		
		<link rel="stylesheet" type="text/css" href="/TFE_Gestidot/CSS/atc.css" media="all" />
		<!-- Scripts -->
		<script type="text/javascript" src="/TFE_Gestidot/JS/jquery.min.js" ></script>
		<script type="text/javascript" src="/TFE_Gestidot/JS/jquery.ui.min.js" ></script>
		
    	

    	<!-- JS bootstrap twitter -->
    	<script type="text/javascript" src="/TFE_Gestidot/JS/bootstrap.min.js"></script>
    	
    	<script type="text/javascript" src="/TFE_Gestidot/JS/atc.js"></script>
    	
<title>Creation planning via le calendrier</title>
</head>
<body>
	<div class="container">
	
		<table id="" class="table table-bordered">
		<tr class="success">
			<th class="text-center">congés</th>
			<th class="text-center">date debut</th>
			<th class="text-center">date fin</th>
		</tr>
		<tr>
		<c:forEach var="i" items="${cal}"> 
			<tr>
			<td><c:out value="${i.libelleVacance.libelleVacance}" /></td> 
			<td class = ""><c:out value="${i.vacance.dateDebutVac}"/></td>
			<td class = ""><c:out value="${i.vacance.dateFinVac}"/></td>
			</tr> 													
		</c:forEach>
		</table>
		 
	</div>
	<div class="container">
		<div class="col-lg-1"></div>
			<div class="col-lg-10">
				<h1 class="text-center">Calendrier ${yearDebut } - ${yearFin }
				 SECTION  ${dtl1}</h1>
				 <p>EndDate = ${dt2}<br>
				 </p>
				 <p><c:out value="${congescoltest}" /></p>
				 <c:set var="nbSemaineScolaire" value="1"  scope="page"/>
			<c:set var="nomConge" value=""  scope="page"/>
			<c:set var="classDisabled" value=""  scope="page"/>
			<c:set var="baliseHtml" value=""  scope="page"/>
			
			<table id="tablePlan" class="table table-bordered">
					<tr class="success">
						<th class="text-center">Key</th>
						<th class="text-center">Value</th>
						
						<!-- <th class="text-center">Dimanche</th>-->
					</tr>
			
					
			
			
				 <c:forEach var="congescol" items="${congescol}">
				 	
				 <tr>
								
								<td><c:out value="${congescol.getLibelleVacance().getLibelleVacance()}" /></td>
								<td><c:out value="${congescol.getDateconge()}" /><br></td>
				</tr>
							
				</c:forEach>
				 
								
				<table id="tablePlan" class="table table-bordered">
					<tr class="success">
						<th class="text-center">congés</th>
						<th class="text-center">N°<br>de<br>semaine</th>
						<th class="text-center">Lundi</th>
						<th class="text-center">Mardi</th>
						<th class="text-center">Mercredi</th>
						<th class="text-center">Jeudi</th>
						<th class="text-center">Vendredi</th>
						<th class="text-center">Samedi</th>
						<!-- <th class="text-center">Dimanche</th>-->
					</tr>
			
					
			<tr>

			
			<c:choose>
				<c:when test="${istart gt 2}"><tr>
					<c:forEach var="i" begin="0" end="${istart}" step="1"><td></td></c:forEach>
				</c:when>
			</c:choose>
			
			
			
			<c:forEach var="listDate" items="${dates}">	
				<c:set var="jour" value="${listDate.toString('dd/MM/yyyy')}"  scope="page"/>			
					<c:forEach var="congescol" items="${congescol}">
							
							<c:if test="${congescol.getDateconge() eq pageScope.jour}">								
									<c:set var="baliseHtml" value="${congescol.getLibelleVacance().getLibelleVacance()}"  scope="page"/>
									<c:set var="classDisabled" value="class=\"disabled\""  scope="page"/>						
							</c:if>
							<c:if test="${congescol.getDateconge() ne pageScope.jour}">								
									<c:set var="baliseHtml" value=""  scope="page"/>
									<c:set var="classDisabled" value=""  scope="page"/>						
							</c:if>	
					</c:forEach>
						<%-- #####################	Début test jour de la semaine ##################### --%>	
						<c:choose>
						<%-- #####################	LUNDI ##################### --%>
							<c:when test="${listDate.dayOfWeek().getAsText(Locale.FRENCH)== 'lundi'}">
								<tr>
								
								<td><c:out value="${pageScope.baliseHtml}" /></td>
								<td><c:out value="${pageScope.nbSemaineScolaire}" /><c:set var="nbSemaineScolaire" value="${nbSemaineScolaire+1}"/></td>
								<td <c:out value="${pageScope.classDisabled}" /> ><c:out value="${listDate.toString('dd/MM/yyyy')}" /></td>
							</c:when>
						<%-- #####################	MARDI ##################### --%>
							<c:when test="${listDate.dayOfWeek().getAsText(Locale.FRENCH)== 'mardi'}">								
								<td <c:out value="${pageScope.classDisabled}" />><c:out value="${listDate.toString('dd/MM/yyyy')}" /></td>
							</c:when>
						<%-- #####################	MERCREDI ##################### --%>
							<c:when test="${listDate.dayOfWeek().getAsText(Locale.FRENCH)== 'mercredi'}">
								<td <c:out value="${pageScope.classDisabled}" /> ><c:out value="${listDate.toString('dd/MM/yyyy')}" /></td>											
							</c:when>
						<%-- #####################	JEUDI ##################### --%>
							<c:when test="${listDate.dayOfWeek().getAsText(Locale.FRENCH)== 'jeudi'}">
								<td <c:out value="${pageScope.classDisabled}" /> ><c:out value="${listDate.toString('dd/MM/yyyy')}" /></td>												
							</c:when>
						<%-- #####################	VENDREDI ##################### --%>
							<c:when test="${listDate.dayOfWeek().getAsText(Locale.FRENCH)== 'vendredi'}">
								<td <c:out value="${pageScope.classDisabled}" /> ><c:out value="${listDate.toString('dd/MM/yyyy')}" /></td>	
							</c:when>
						<%-- #####################	SAMEDI ##################### --%>
							<c:when test="${listDate.dayOfWeek().getAsText(Locale.FRENCH)== 'samedi'}">
								<td <c:out value="${pageScope.classDisabled}" /> ><c:out value="${listDate.toString('dd/MM/yyyy')}" /></td>												
							</c:when>
						<%-- #####################	DIMANCHE ##################### --%>
							<c:when test="${listDate.dayOfWeek().getAsText(Locale.FRENCH)== 'dimanche'}">
								<%-- <td class="disabled"><c:out value="${listDate.toString('dd/MM/yyyy')}" /></td>--%>
								</tr>				
							</c:when>
						<%-- #####################	FIN SEMAINE ##################### --%>
							<c:otherwise></c:otherwise>
						</c:choose>	
										 
			</c:forEach>
				<%-- #####################	AJOUT JOURS SI FIN D'ANNEE ATTEINTE ? ##################### --%>
				<c:choose>	
				<c:when test="${kstart gt 2}"><tr>
					<c:forEach var="i" begin="0" end="${kstart}" step="1"><td></td></c:forEach>
				</c:when> 
				</c:choose>	
				</table>
			
				</div><!--  FIN ./col-xs-8 -->
	<div class="col-lg-1"></div>	
</div>

</body>
</html>
